package net.qiqbframework.modelling.command.fetching;


import lombok.Getter;
import lombok.Setter;
import net.qiqbframework.modelling.command.BizIdentifierVoucherMember;

import java.util.Optional;

/**
 * 加载凭证可以有多个业务ID加载
 */
public class LoadVoucher {

    @Getter
    private final BizIdentifierVoucherMember bizIdentifierMember;
    /**
     * 版本号
     */
    @Setter
    private Long expectedVersion;

    public LoadVoucher(BizIdentifierVoucherMember bizIdentifierMember) {
        this(bizIdentifierMember, null);
    }

    public LoadVoucher(BizIdentifierVoucherMember bizIdentifierMember, Long version) {
        this.bizIdentifierMember = bizIdentifierMember;
        this.expectedVersion = version;
    }


    public Optional<Long> getExpectedVersion() {
        // 加载版本号
        return Optional.ofNullable(expectedVersion);
    }

}
